package com.itheima.health.consumer;

import com.itheima.health.common.RocketMQConst;
import com.itheima.health.message.SendValidateRocketMQ;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@RocketMQMessageListener(topic = RocketMQConst.TOPIC_ORDER_SEND,consumerGroup = "order-send-consumer")
public class OrderSendConsumer implements RocketMQListener<SendValidateRocketMQ> {
    @Override
    public void onMessage(SendValidateRocketMQ orderRocketMQ) {
        log.info("[短信发送消费者]received message: {}", orderRocketMQ);
        try {
            Thread.sleep(10000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("[短信发送消费者]模拟发送，发送中……");
        log.info("[短信发送消费者]发送成功");
    }
}
